package com.example.demo;


public class DecoratorDemo {
    public static void main(String[] args) {
        Drawable flower=new Flower();
        flower=new Mount(flower);
        flower=new Hook(flower);
        System.out.println(flower.draw());
    }
    public static class Mount implements Drawble{
        private Drawable drawable;
        public Mount(Drawable drawable){
            this.drawable=drawable;
        }
        public static class Hook implements Drawble{
            private Drawable drawable;
            public Hook(Drawable drawable){
                this.drawable=drawable;
            }
            public String draw(){
            return "----|---\n"+drawable.draw();
            }
        }
        @Override
        public String draw(){
            StringBuilder builder=new StringBuilder();
            builder.append("-----n");
            builder.append("|--");
            drawable.draw();
            builder.append("--|");
            builder.append("------\n");
            return builder.toString();
        }
    }
}
